sending email with php

sending email with php

am 23.12.2009 21:58:17 von Sudhakar

--001636b148eaeea8dd047b6b94ab
Content-Type: text/plain; charset=ISO-8859-1


$headers = "Content-type: text/html; charset=iso-8859-1";
$to="myemailaddress";
$subject="Email Newsletter";

$message = ' http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Email Newsletter


















';

if(! mail($to, $subject, $message, $headers)){
echo "There was an error is sending the email";
}
else{
echo "The email has been sent";
}
?>

hi

my question is about send an email with php like a newsletter, when we read
a newsletter email its similar to a webpage which contains content, images,
css and other elements

i created a static webpage initially with html css and images folder after
creating the page i wanted to test to see how it would look if i were to
send this as an email like a newsletter.

so i have created a php file with
$headers = "Content-type: text/html; charset=iso-8859-1";
$to="myemailaddress";
$subject="Email Newsletter";
and
$message as mentioned above has the entire html code as i used it in my
static html page
i also copied the style.css in the server and created images folder and
copied all the images i used in my static page to the server.

i created a separate folder in my webserver called newsletter and copied the
php file, css file and images folder with the images i used

when i accessed the index.php as http://website.com/emailnewsletter i am
getting a message that The email has been sent and i am getting the email

however my question is when i open this email the styles and images are not
being applied and i see only the text in the static page i created.


can someone let me know how i can fix this so that when i open the email it
would look like the static page i created with all the styles applies and
images displayed

is this only possible by using specialized email softwares or can it be done
by php as well with the logic used.


any help will be appreciated.

thanks

--001636b148eaeea8dd047b6b94ab--

Re: sending email with php

am 23.12.2009 22:07:40 von andy-lists

Hi Suhakar,

>

Relative URLs won't work - when it's rendered inside the e-mail client, =
the relative URL has no meaning (I believe Outlook renders relative URLs =
relative to the temporary directory the HTML is being rendered in.) =
Other clients may do it relative to an imap://.... URL.

Try uploading the images and stylesheet to your website and putting them =
within the newsletter as absolute URLs (including the images) - e.g. =
href=3D"http://www.yourwebsite.com/style.css" />

Also I know this is OT and is completely up to you, but remember to =
include a plain-text part, and also realise that a lot of mail clients =
don't render images/stylesheets by default - therefore straight after =
the tag before the rest of the content, put a link to an external =
website where recipients can view the content online.

Regards,
Andy


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: sending email with php

am 24.12.2009 05:29:58 von kranthi

--0016369209b2762626047b71e56a
Content-Type: text/plain; charset=ISO-8859-1

another point worth noting...

most of the major email clients does not display external css/images by
default. The user will have to grant permission explicitly.

--0016369209b2762626047b71e56a--

Re: sending email with php

am 24.12.2009 05:46:00 von kranthi

--001636d33959cd141a047b721eb5
Content-Type: text/plain; charset=ISO-8859-1

No. You must have noticed gmail saying "images are blocked from .. ". This
is done to prevent spammers from knowing if your email is authentic or not.
Moreover you must have also noticed that all the news letters have a link
pointing to a web page version of the newsletter.

--001636d33959cd141a047b721eb5--

Re: sending email with php

am 29.12.2009 23:42:14 von George Langley



is a straight-ahead overview of what you can/should/cant/shouldn't do
in HTML e-mails.

Or check out:

>

for some heavy-duty mail classes (be sure to check the "See Also"
section for the full story).
I also referenced the following:



on the basics of sending multi-part e-mail (ie. plain text AND HTML).
HTH.


George

On 23-Dec-09, at 1:58 PM, Sudhakar wrote:

> >
> $headers = "Content-type: text/html; charset=iso-8859-1";
> $to="myemailaddress";
> $subject="Email Newsletter";
>
> $message = ' > Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
> Email Newsletter
>
>
>
>
>
>
>


>

>

>

>

>

>

>

>

>
>

>
> ';
>
> if(! mail($to, $subject, $message, $headers)){
> echo "There was an error is sending the email";
> }
> else{
> echo "The email has been sent";
> }
> ?>
>
> hi
>
> my question is about send an email with php like a newsletter, when
> we read
> a newsletter email its similar to a webpage which contains content,
> images,
> css and other elements
>
> i created a static webpage initially with html css and images folder
> after
> creating the page i wanted to test to see how it would look if i
> were to
> send this as an email like a newsletter.
>
> so i have created a php file with
> $headers = "Content-type: text/html; charset=iso-8859-1";
> $to="myemailaddress";
> $subject="Email Newsletter";
> and
> $message as mentioned above has the entire html code as i used it in
> my
> static html page
> i also copied the style.css in the server and created images folder
> and
> copied all the images i used in my static page to the server.
>
> i created a separate folder in my webserver called newsletter and
> copied the
> php file, css file and images folder with the images i used
>
> when i accessed the index.php as http://website.com/emailnewsletter
> i am
> getting a message that The email has been sent and i am getting the
> email
>
> however my question is when i open this email the styles and images
> are not
> being applied and i see only the text in the static page i created.
>
>
> can someone let me know how i can fix this so that when i open the
> email it
> would look like the static page i created with all the styles
> applies and
> images displayed
>
> is this only possible by using specialized email softwares or can it
> be done
> by php as well with the logic used.
>
>
> any help will be appreciated.
>
> thanks


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php